package booroo.basic;

import java.util.Scanner;

import booroo.model.ProductVO;

public class J17_ProductMain {
	private static final String title = "배열을 이용한 상품등록프로그램";
	private static final String menu = ">> (1)추가 (2)조회 (3)종료";
	private static final String addmsg = "번호,이름,설명,제조사,가격순으로 입력";
	private static final String exitmsg = "프로그램을 종료합니다";
	
	public static void main(String[] args) {
		J17_Product psrv = new J17_Product();
		Scanner sc = new Scanner(System.in);
		
		System.out.println(title);
		while(true){
			System.out.println(menu);
			switch(sc.nextInt()){
			case 1: addProduct(sc, psrv); break;
			case 2: showProduct(psrv); break;
			case 3: sc.close(); System.out.println(exitmsg); System.exit(0); break;
			} // switch
		} // while
		
	} // main

	private static void addProduct(Scanner sc,J17_Product psrv) {
		System.out.println(addmsg);		
		ProductVO pvo = new ProductVO(
						sc.next(),sc.next(),sc.next(),sc.next(),sc.nextInt());
		psrv.addProduct(pvo);
		}

	private static void showProduct(J17_Product psrv) {
			System.out.println(psrv.readProduct());	
	}

} // class
